<template>
	<view style="padding-top: 150px">
		<view style="margin-top: 30px">
			<button type="primary" @click="subscribe">订阅服务通知</button>
		</view>
		<view style="margin-top: 30px">
			<button type="warn" @click="sendSubscribeMessage">发送服务通知</button>
		</view>
		<view style="margin-top: 30px">
			<button @click="nvb">返回</button>
		</view>
	</view>
</template>

<script>
	import {
		uRequestSubscribeMessage
	} from '../../utils/uniUtils';

	export default {
		data() {
			return {
				json: {
					page: "index",
					lang: "zh_CN",
					data: {
						thing3: {
							value: "339208499",
						},
						thing5: {
							value: "2015年01月05日",
						},
					},
					template_id: "LPOJNg_fS9sJfRErZXh72TT7z5qPL8eBlE8VwCzgga4",
					miniprogram_state: "developer",
				},
			};
		},

		methods: {
			subscribe() {

				uRequestSubscribeMessage([
					"bxlRjWHlz_vLq2YmTqbP9qIYHRBSem17opZTb9JWJMg" // 下单成功通知
					// ,"", // 取餐通知
					// "", // 评价通知
				]);
			},
			sendSubscribeMessage() {
				uni.request({
					url: "http://192.168.3.229:8080/api/wechat/tst",
					method: "POST",
					header: {
						Authorization: "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9naXZlbm5hbWUiOiLliIblupcxMDA1IiwiaHR0cDovL3NjaGVtYXMueG1sc29hcC5vcmcvd3MvMjAwNS8wNS9pZGVudGl0eS9jbGFpbXMvbmFtZSI6IjEwMDUiLCJqdGkiOiI1Iiwic3RvcmVJZCI6IjEwMDUiLCJjb3JwSWQiOiIxMDAxIiwic3BsaXRJZCI6IjIwMjMwOSIsInNpZ24iOiJVcHFZMVZybTlPZUNRYUZsOThFVllRPT0iLCJodHRwOi8vc2NoZW1hcy5taWNyb3NvZnQuY29tL3dzLzIwMDgvMDYvaWRlbnRpdHkvY2xhaW1zL2V4cGlyYXRpb24iOiIyMDI0LTA4LTIxIDE2OjA5OjIxIiwiaHR0cDovL3NjaGVtYXMubWljcm9zb2Z0LmNvbS93cy8yMDA4LzA2L2lkZW50aXR5L2NsYWltcy9yb2xlIjoic3RhZmYiLCJuYmYiOjE3MjQxNDEzNjEsImV4cCI6MTcyNDIyNzc2MSwiaXNzIjoiQ29yZVNob3BQcm9mZXNzaW9uYWwiLCJhdWQiOiJDb3JlQ21zIn0.P_6URwYm53UeUqtWvM_cNjGfG4IjFWmkMFnp3eQTWwM",
					},
					success(res) {
						console.log("res-->", res);
					},
				});
			},
			onClickGetUserInfo() {
				uni.getUserInfo({
					success(res) {
						console.log("res==>", res);
					},
				});
			},
			nvb() {
				uni.navigateBack();
			},
		},
	};
</script>

<style></style>